package com.fattyCorps.common.packet.hero.component.prop.component;

import com.fattyCorps.common.enums.battle.prop.EStaticProp;
import com.fattyCorps.common.packet.hero.component.prop.HeroProp;

/**
 * 基础属性
 * 初始+等级属性
 */
public class BaseProp extends ABasePropComponent {
    @Override
    public void onInit() {
        owner = this.getOwner();
    }

    @Override
    public void onUpdate() {
        owner.incProp(HeroProp.ECalcPropType.BaseAdd, EStaticProp.Att, heroMould.getInitAtt().toString());
        owner.incProp(HeroProp.ECalcPropType.BaseAdd, EStaticProp.Def, heroMould.getInitDef().toString());
        owner.incProp(HeroProp.ECalcPropType.BaseAdd, EStaticProp.MaxHp, heroMould.getInitMaxHp().toString());
        owner.incProp(HeroProp.ECalcPropType.BaseAdd, EStaticProp.Speed, heroMould.getInitSpeed().toString());
        owner.incProp(HeroProp.ECalcPropType.BaseAdd, EStaticProp.SkillDamage, heroMould.getInitSkillDamagePer().toString());
        owner.incProp(HeroProp.ECalcPropType.BaseAdd, EStaticProp.Precise, heroMould.getInitPrecisePer().toString());
        owner.incProp(HeroProp.ECalcPropType.BaseAdd, EStaticProp.Parry, heroMould.getInitParryPer().toString());
        owner.incProp(HeroProp.ECalcPropType.BaseAdd, EStaticProp.Critical, heroMould.getInitCriticalPer().toString());
        owner.incProp(HeroProp.ECalcPropType.BaseAdd, EStaticProp.CriticalDamage, heroMould.getInitCriticalDamagePer().toString());
        owner.incProp(HeroProp.ECalcPropType.BaseAdd, EStaticProp.ArmorBreak, heroMould.getInitArmorBreakPer().toString());
        owner.incProp(HeroProp.ECalcPropType.BaseAdd, EStaticProp.ImmunityControl, heroMould.getInitImmunityControlPer().toString());
        owner.incProp(HeroProp.ECalcPropType.BaseAdd, EStaticProp.ReduceDamage, heroMould.getInitReduceDamagePer().toString());
        owner.incProp(HeroProp.ECalcPropType.BaseAdd, EStaticProp.SacredDamage, heroMould.getInitSacredDamagePer().toString());
        owner.incProp(HeroProp.ECalcPropType.BaseAdd, EStaticProp.ReduceCritical, heroMould.getInitReduceCriticalPer().toString());
        owner.incProp(HeroProp.ECalcPropType.BaseAdd, EStaticProp.IncDamage, heroMould.getInitIncDamagePer().toString());
        owner.incProp(HeroProp.ECalcPropType.BaseAdd, EStaticProp.IncControl, heroMould.getInitIncControlPer().toString());

        int lv = hero.getLv();
        String attLv = ((long)heroMould.getLvUpAtt() * (lv - 1)) + "";
        String defLv = ((long)heroMould.getLvUpDef() * (lv - 1)) + "";
        String maxHpLv = ((long)heroMould.getLvUpMaxHp() * (lv - 1)) + "";

        owner.incProp(HeroProp.ECalcPropType.BaseAdd, EStaticProp.Att, attLv);
        owner.incProp(HeroProp.ECalcPropType.BaseAdd, EStaticProp.Def, defLv);
        owner.incProp(HeroProp.ECalcPropType.BaseAdd, EStaticProp.MaxHp, maxHpLv);
    }

    @Override
    public void onEvent(int e, Object[] objs) {

    }
}
